package com.java2_15;

public class People1 {
    private String name;
    private int age;

    public People1() {

    }

    public People1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void KeepPet(Animal1 animal, String something) {
        if (animal instanceof Dog1) {
            System.out.println("年龄为" + getAge() + "岁的" + getName() + "养了一只" + animal.getColor() + "颜色的" + animal.getAge() + "岁的狗");
            animal.eat(something);
        }
        if (animal instanceof Cat1) {
            System.out.println("年龄为" + getAge() + "岁的" + getName() + "养了一只" + animal.getColor() + "颜色的" + animal.getAge() + "岁的猫");
            animal.eat(something);
        }

    }
}
